package com.zhi.service.impl;

import com.zhi.dao.HealthInfoRepository;
import com.zhi.entity.HealthInfo;
import com.zhi.service.HealthInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HealthInfoServiceImpl implements HealthInfoService {
    @Autowired
    private HealthInfoRepository healthInfoRepository;

    @Override
    public void deleteById(Integer id) {
        healthInfoRepository.deleteById(id);
    }

    @Override
    public List<HealthInfo> findAllByUserId(int id) {
        return healthInfoRepository.findAllByUserId(id);
    }

    @Override
    public Page<HealthInfo> findAllDesc(Pageable pageable,int userid) {
        return healthInfoRepository.findAllDesc(pageable,userid);
    }

    @Override
    public HealthInfo getOne(int id) {
        return healthInfoRepository.getOne(id);
    }


    @Override
    public void edit(HealthInfo healthInfo) {
        healthInfoRepository.save(healthInfo);
    }

}
